package cn.wjc.demo.parttwo.service.impl;

import cn.wjc.demo.common.entity.Partner;
import cn.wjc.demo.common.entity.Student;
import cn.wjc.demo.common.page.PageQuery;
import cn.wjc.demo.parttwo.mapper.IStudentMapper;
import cn.wjc.demo.parttwo.service.IStudentService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;

@Slf4j
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class StudentServiceImpl implements IStudentService {

    private final IStudentMapper studentMapper;


    @Override
    public void addStudent(Student student) {
        log.info("正在执行【插入学生】的业务...");
        //log.info("发生了异常！！！");
        //throw new RuntimeException();
        if ( (Math.random()) > 0.6 ) {
            System.out.println("Parttwo 本地【插入学生】时发生异常！");
            throw new RuntimeException();
        }
        studentMapper.insert(student);
        System.out.println("Parttwo 本地【插入学生】结束！");
    }


}
